# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName : p16.py
# @Time     : 2024/5/9 23:39
# @Author   : Robot-Zsj
"""
description:

篮球游戏

https://fcqian.blog.csdn.net/article/details/135391795

i:
4,5,6,7,0,1,2
6,4,0,1,2,5,7

o:
RLRRRLL

"""
ipts = list(map(int, input().split(",")))
opts = list(map(int, input().split(",")))


def getResult():
    queue = []
    index = 0
    res = []
    for ipt in ipts:
        queue.append(ipt)
        while len(queue) > 0 and index < len(opts):
            left = queue[0]
            right = queue[-1]
            if left == opts[index]:
                res.append("L")
                queue.pop(0)
                index += 1
            elif right == opts[index]:
                res.append("R")
                queue.pop()
                index += 1
            else:
                break

    if index != len(opts):
        return "NO"
    else:
        return "".join(map(str, res))


print(getResult())
